#include<iostream>
#include<cstdio>
using namespace std;
int arr[3];
int main()
{
	char x, y;
	while (2 == scanf_s("%c:=%c;", &x, &y)) {
		if (y >= '0' && y <= '9') {
			arr[x - 'a'] = y - '0';
		}
		else {
			arr[x - 'a'] = arr[y - 'a'];
		}
	}
	cout << arr[0] << " " << arr[1] << " " << arr[2] << endl;
	return 0;
}